package com.study.ureport;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;

import com.bstek.ureport.console.UReportServlet;

@ImportResource("classpath:ureport-console-context.xml")//读取配置文件
@SpringBootApplication
public class UReportApplication {

	public static void main(String[] args) {
		SpringApplication.run(UReportApplication.class, args);
	}

	/**
	 * 注入ureport对应的servlet
	 * @return
	 */
	@Bean
	public ServletRegistrationBean<UReportServlet> ureportServlet() {
		ServletRegistrationBean<UReportServlet> bean = new ServletRegistrationBean<>(new UReportServlet());
		bean.addUrlMappings("/ureport/*");
		return bean;
	}
}
